package com.linkoog.devtools.code_generator.template.model.node;

import com.linkoog.devtools.code_generator.template.model.ContainerNodeData;

import java.io.Serializable;


public class DirNodeData extends ContainerNodeData implements Serializable {

    private static final long serialVersionUID = -8843957173498883576L;

    public DirNodeData(){}

    public DirNodeData(String name) {
        this.name = name;
    }

    @Override
    public DirNodeData copy() {
        DirNodeData dirNodeData = new DirNodeData();
        dirNodeData.setName(this.getName());
        return dirNodeData;
    }

    @Override
    public DirNodeData deepCopy() {
        DirNodeData dirNodeData = copy();
        dirNodeData.addChildNode(copyList());
        return dirNodeData;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }

        DirNodeData that = (DirNodeData) o;

        if (name != null ? !name.equals(that.name) : that.name != null) {
            return false;
        }

        if (getChildNodeList() != null ?
                getChildNodeList().size() != that.getChildNodeList().size() || !getChildNodeList().equals(that.getChildNodeList())
                : that.getChildNodeList() != null) {
            return false;
        }

        return true;
    }
}
